Skip to main content

FrontInstanceGroup

Wolfram Kernel
Execution environment
Notebook`Editor`Kernel`FrontSubmitService`
Context
FrontInstanceGroup[] _FrontInstanceGroup

constructs a wrapper, which allows dispose a group of virtual WLJS Functions (aka instances of WL symbols) on the frontend.

Normally one can append objects on existing plots using FrontSubmit, this wrapper allows to undo those action by disposing the created instances (even if they are nested). It does also support batch operations.

To add expressions into created group, use the following pattern

g = FrontInstanceGroup[];
g[{Red, Disk[]}]
note

This expression is immutable

Methods

FrontSubmit

Evaluates the group on the frontend

group = FrontInstanceGroup[];
FrontSubmit[group[expr_], scene]

one can submit multiple groups as well

...
FrontSubmit[{group1[expr_], group2, ...}, scene]

Delete

Disposes created group (s)

Delete[_FrontInstanceGroup | __FrontInstanceGroup]

Example

The common use case is to be able to add and remove groups of expressions from the some frontend instance. For example to add and then remove primitives from a plot

scene = FrontInstanceReference[];
Plot[x, {x,0,1}, Epilog->{scene}]

now add an object

group = FrontInstanceGroup[];
FrontSubmit[{Red, Disk[]} // group, scene];

and delete

Delete[group]